<div class="row">
	<div class="col-md-12">
		<ol class="breadcrumb">
			<li>
				<a href="#" onclick="toHome()">
					主页
				</a>
			</li>
			<li>
				<a href="#" class="toList" onclick="toFuncManage()">
					功能管理
				</a>
			</li>
			<li class="active">
				添加功能
			</li>
		</ol>
	</div>
</div>
<form role="form" class="form-horizontal">
	<div class="row page-cont">
		<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cont-top">
			<div class="panel panel-white">
				<div class="panel-heading">
					<h4 class="panel-title">
						<span class="title-text">添加功能</span>
					</h4>
					<div class="panel-tools">
						<div class="dropdown">
							<a data-toggle="dropdown" class="btn btn-xs dropdown-toggle btn-transparent-grey">
								<i class="fa fa-cog"></i>
							</a>
							<ul class="dropdown-menu dropdown-light pull-right" role="menu">
								<li>
									<a class="panel-collapse collapses" href="#"><i class="fa fa-angle-up"></i> <span>折叠</span> </a>
								</li>
								<li>
									<a class="panel-expand" href="#">
										<i class="fa fa-expand"></i> <span>全屏</span>
									</a>
								</li>
							</ul>
						</div>
						<a class="btn btn-xs btn-link panel-close" href="#">
							<i class="fa fa-times"></i>
						</a>
					</div>
				</div>
				<div class="panel-body">
					<div class="body-cont">
					  	<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">模块名称</label>
						    <div class="col-sm-6">
						      	<input type="text" class="form-control" />
						    </div>
							<button type="button" class="btn btn-blue">选择</button>					    
					  	</div>
					  	<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">名称</label>
						    <div class="col-sm-6">
								<input type="text" class="form-control" />
						    </div>
							<span class="col-sm-4 tips">
						    	<i class="fa fa-info-circle"></i>
						    	2-25位任意字符
						    </span>						    
					  	</div>
					  	<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">权限验证</label>
						    <div class="col-sm-6">
						     	<select>
						     		<option value="">是</option>
						     		<option value="">否</option>
						     	</select>
						    </div>					    
					  	</div>
						<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">url</label>
						    <div class="col-sm-6">
								<input type="text" class="form-control" />
						    </div>
							<span class="col-sm-4 tips">
						    	<i class="fa fa-info-circle"></i>
						    	1-200位字符
						    </span>						    
					  	</div>	
						<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">是否分负</label>
						    <div class="col-sm-6">
						     	<select>
						     		<option value="">是</option>
						     		<option value="">否</option>
						     	</select>
						    </div>					    
					  	</div>					  	
						<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">行级过滤</label>
						    <div class="col-sm-6">
						     	<select>
						     		<option value="">是</option>
						     		<option value="">否</option>
						     	</select>
						    </div>					    
					  	</div>					  	
						<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">重复提交验证</label>
						    <div class="col-sm-6">
						     	<select>
						     		<option value="">是</option>
						     		<option value="">否</option>
						     	</select>
						    </div>					    
					  	</div>	
						<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">IP验证</label>
						    <div class="col-sm-6">
						     	<select>
						     		<option value="">是</option>
						     		<option value="">否</option>
						     	</select>
						    </div>					    
					  	</div>	
						<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">返回url</label>
						    <div class="col-sm-6">
								<input type="text" class="form-control" />
						    </div>
							<span class="col-sm-4 tips">
						    	<i class="fa fa-info-circle"></i>
						    	0-200位长度
						    </span>						    
					  	</div>						  	
						<div class="form-group panel-cont">
						    <label class="col-sm-2 control-label">返回参数</label>
						    <div class="col-sm-6">
								<input type="text" class="form-control" />
						    </div>
							<span class="col-sm-4 tips">
						    	<i class="fa fa-info-circle"></i>
						    	0-100位长度
						    </span>						    
					  	</div>						  					  					  					  	
					</div>
				  	<div class="form-group panel-btn">
				  		<div class="col-sm-2 col-sm-offset-3">
				  			<button type="button" class="btn btn-danger submit-btn">提交&nbsp;<i class="fa fa-arrow-circle-right"></i></button>
				  		</div>
				  	</div>
				</div>
			</div>
		</div>
	</div>
</form>
<script>
	/**********************************************变量**********************************************/
	var token = MXCookie.get("token",token);     // 登陆token;
	var username = GetQueryString("username");   // 用户名


	
	/**********************************************事件**********************************************/
	

	// 提交
	$(".submit-btn").click(function(){
		if(msgCheck()){
			// addCoupon();
		}
	});
	/**********************************************函数**********************************************/


	// 信息验证
	function msgCheck(){
		if($(".systemNum").val() == ""){
			tips("请填写编号");
			$(this).focus();
			return false;
		}else if($(".systemName").val() == ""){
			tips("请填写名称");
			$(this).focus();
			return false;
		}else if($(".systemTurn").val() == ""){
			tips("请填写排序");
			$(this).focus();
			return false;
		}else{
			return true;
		}
	}

	


	// 新增优惠券
	function addCoupon(){
		$.ajax({
			url: localStorage.grobalUrl + "/discount/addDiscount",
			type: "post",
			data:{
				username: GetQueryString("username"),
				token: token,	
				film_id: $(".check-film").attr("data-id"),
				film_name: $(".check-film").val(),
				name: $(".couponName").val(),
				prefix: $(".applyScene").find("option:selected").val(),
				introduction: $(".couponIntro").val(),
				beginDate: $(".startDate").val(),
				endDate: $(".endDate").val(),
				maxPrice: $(".maxPrice").val(),

			},
			success: function(data){
				console.log(data);
				if(data.errCode == "00001"){
					tips("通兑券添加失败");
				}else if(data.errCode == "00000"){
					getPage("view/exchangeCard/list.html");
				}else if(data.errCode == "00005"){
					tips("请重新登陆");
					setTimeout(function(){
						window.location.href = "login_login.html";
					},500);					
				}else{}
			},
			error: function(error){
				console.log(error);
			}
		});
	}
	
</script>
